#from subprocess import check_call
from forest.api import Command, get_tool

class BuildISO(Command):
    __register__ = 'commands.live.buildiso'
    def __init__(self):
        super(BuildISO, self).__init__()

    def run(self, config):
        
        installtree = os.path.join(self._config.get_build_root(), 'isoroot')

        with get_tool('system.cd')(installtree):
            get_tool('system.execute')(['mkisofs', '-D', '-r', '-V', 'INSTALLER', '-cache-inodes', '-J', '-l', '-b', 'isolinux/isolinux.bin', '-c', 'isolinux/boot.cat', '-no-emul-boot', '-boot-load-size', '4', '-boot-info-table', '-o', self.args.get('destination', 'forest.iso'), '.'])
